Skip to content

Conversation

@joshheald
Copy link
Contributor

Description

This PR updates the skipReason we track to include pos_not_opened_30_days. The skip event also gets a sync_type property.

Test Steps

Ensure you're using local catalog by setting the app version to 23.8 in the project file.
Replace .days with .seconds in POSCatalogSyncCoordinator.syncEligibility(for:) to speed up time.
Assuming you've previously synced, you'll see the event below tracked when you launch the app.

pos_not_eligible is a theoretical event, and doesn't get tracked, because we don't set up all the infrastructure in that case.

Screenshots

CleanShot 2025-11-21 at 16 12 29@2x
  • I have considered if this change warrants user-facing release notes and have added them to RELEASE-NOTES.txt if necessary.

@joshheald joshheald added this to the 23.8 milestone Nov 21, 2025
@joshheald joshheald added type: task An internally driven task. category: tracks Related to analytics, including Tracks Events. labels Nov 21, 2025
@joshheald joshheald marked this pull request as ready for review November 21, 2025 16:43
@wpmobilebot
Copy link
Collaborator

App Icon📲 You can test the changes from this Pull Request in WooCommerce iOS Prototype by scanning the QR code below to install the corresponding build.

App NameWooCommerce iOS Prototype
Build Numberpr16382-15cfef7
Version23.7
Bundle IDcom.automattic.alpha.woocommerce
Commit15cfef7
Installation URL0jjufiklsasi0
Automatticians: You can use our internal self-serve MC tool to give yourself access to those builds if needed.

Copy link
Contributor

@iamgabrielma iamgabrielma left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

First sync:

🔵 Tracked pos_local_catalog_sync_skipped, properties: [sync_type: full, reason: pos_not_opened_30_days]

Subsequent sync:

🔵 Tracked pos_local_catalog_sync_skipped, properties: [reason: pos_not_opened_30_days, sync_type: incremental]

Comment on lines +807 to +808
case .notOpenedRecently: "pos_not_opened_30_days"
case .neverOpenedAndPastFirstSyncGracePeriod: "pos_not_opened_30_days"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it ok to use the same pos_not_opened_30_days value for both cases notOpenedRecently and neverOpenedAndPastFirstSyncGracePeriod? I noticed it is expected by the coordinator tests, but raising it just in case 👍

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, they're basically the same thing

Comment on lines +728 to +748
switch try await syncEligibility(for: siteID) {
case .eligible(reason: let reason):
switch reason {
case .neverSynced:
DDLogInfo("📋 POSCatalogSyncCoordinator: Site \(siteID) eligible (no first sync date recorded)")
case .openedRecently(daysSinceOpened: let daysSinceOpened):
DDLogInfo("📋 POSCatalogSyncCoordinator: Site \(siteID) eligible (last opened \(daysSinceOpened) days ago)")
case .recentFirstSync(daysSinceFirstSync: let daysSinceFirstSync):
DDLogInfo("📋 POSCatalogSyncCoordinator: Site \(siteID) eligible (within grace period: \(daysSinceFirstSync) days since first sync)")
}
return true
case .ineligible(reason: let reason):
switch reason {
case .notEligibleForLocalCatalog:
DDLogInfo("📋 POSCatalogSyncCoordinator: Site \(siteID) - Catalog ineligible")
case .notOpenedRecently(daysSinceOpened: let daysSinceOpened):
DDLogInfo("📋 POSCatalogSyncCoordinator: Site \(siteID) ineligible (POS last opened \(daysSinceOpened) days ago)")
case .neverOpenedAndPastFirstSyncGracePeriod(daysSinceFirstSync: let daysSinceFirstSync):
DDLogInfo("📋 POSCatalogSyncCoordinator: Site \(siteID) ineligible (past 30-day grace period, " +
"no recent POS open, \(daysSinceFirstSync) days since first sync)")
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need these DDLogInfo? If we don't, we could either return the bool directly or remove the function entirely (depending on the other usages of syncEligibility(for siteID: Int64) async throws -> SyncEligibility)

    func checkSyncEligibility(for siteID: Int64) async throws -> Bool {
        switch try await syncEligibility(for: siteID) {
        case .eligible:
            return true
        case .ineligible:
            return false
        }
    }

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They're the pre-existing, I just moved them to reuse the underlying logic, and they're pretty helpful to figure out what's going on...

@joshheald joshheald merged commit dc27720 into trunk Nov 24, 2025
24 checks passed
@joshheald joshheald deleted the woomob-1763-local-catalog-use-specific-skip-reasons-in-analytics branch November 24, 2025 16:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

category: tracks Related to analytics, including Tracks Events. type: task An internally driven task.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants